package com.ywu.application.standard.redisCache.api;

import com.ywu.common.result.CommonResult;
import com.ywu.application.standard.redisCache.dto.RedisCacheDto;
import com.ywu.application.standard.redisCache.service.RedisExecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName RedisExecApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2025/3/22 16:19
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/redis/cache")
public class RedisExecApi {
    @Autowired
    private RedisExecService service;

    /**
    * @Author GroundDemo
    * @Description 查询缓存信息
    * @Date 16:22 2025/3/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/redis.cache.info")
    public CommonResult<Object> queryRedisCache(@RequestBody RedisCacheDto dto) {
        return service.queryRedisCache(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除缓存
    * @Date 18:08 2025/3/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/redis.cache.delete.info")
    public CommonResult<Object> deleteRedisCache(@RequestBody RedisCacheDto dto) {
        return service.deleteRedisCache(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 批量删除
    * @Date 19:37 2025/3/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/redis.cache.delete.batch.info")
    public CommonResult<Object> deleteRedisCacheBatch(@RequestBody RedisCacheDto dto) {
        return service.deleteRedisCacheBatch(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 添加redis缓存
    * @Date 18:41 2025/3/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/redis.cache.add.info")
    public CommonResult<Object> addRedisCache(@RequestBody RedisCacheDto dto) {
        return service.addRedisCache(dto);
    }
}
